<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Learning from Examples &raquo; Graph Processing Pipeline | Taskflow QuickStart</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
  <link rel="icon" href="favicon.ico" type="image/x-icon" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="theme-color" content="#22272e" />
</head>
<body>
<header><nav id="navigation">
  <div class="m-container">
    <div class="m-row">
      <span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
        <a href="https://taskflow.github.io"><img src="taskflow_logo.png" alt="" />Taskflow</a> <span class="m-breadcrumb">|</span> <a href="index.html" class="m-thin">QuickStart</a>
      </span>
      <div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
        <a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
          <path id="m-doc-search-icon-path" d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z"/>
        </svg></a>
        <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
        <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
      </div>
      <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
        <div class="m-row">
          <ol class="m-col-t-6 m-col-m-none">
            <li><a href="pages.html">Handbook</a></li>
            <li><a href="namespaces.html">Namespaces</a></li>
          </ol>
          <ol class="m-col-t-6 m-col-m-none" start="3">
            <li><a href="annotated.html">Classes</a></li>
            <li><a href="files.html">Files</a></li>
            <li class="m-show-m"><a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
              <use href="#m-doc-search-icon-path" />
            </svg></a></li>
          </ol>
        </div>
      </div>
    </div>
  </div>
</nav></header>
<main><article>
  <div class="m-container m-container-inflatable">
    <div class="m-row">
      <div class="m-col-l-10 m-push-l-1">
        <h1>
          <span class="m-breadcrumb"><a href="Examples.html">Learning from Examples</a> &raquo;</span>
          Graph Processing Pipeline
        </h1>
        <nav class="m-block m-default">
          <h3>Contents</h3>
          <ul>
            <li><a href="#FormulateTheGraphProcessingPipelineProblem">Formulate the Graph Processing Pipeline Problem</a></li>
            <li>
              <a href="#CreateAGraphProcessingPipeline">Create a Graph Processing Pipeline</a>
              <ul>
                <li><a href="#GraphPipelineFindATopologicalOrderOfTheGraph">Find a Topological Order of the Graph</a></li>
                <li><a href="#GraphPipelineDefineTheStageFunction">Define the Stage Function</a></li>
                <li><a href="#GraphPipelineDefineThePipes">Define the Pipes</a></li>
                <li><a href="#GraphPipelineDefineTheTaskGraph">Define the Task Graph</a></li>
                <li><a href="#GraphPipelineSubmitTheTaskGraph">Submit the Task Graph</a></li>
              </ul>
            </li>
            <li><a href="#GraphPipelineReference">Reference</a></li>
          </ul>
        </nav>
<p>We study a graph processing pipeline that propagates a sequence of linearly dependent tasks over a dependency graph. In this particular workload, we will learn how to transform task graph parallelism into pipeline parallelism.</p><section id="FormulateTheGraphProcessingPipelineProblem"><h2><a href="#FormulateTheGraphProcessingPipelineProblem">Formulate the Graph Processing Pipeline Problem</a></h2><p>Given a directed acyclic graph (DAG), where each node encapsulates a sequence of linearly dependent tasks, namely <em>stage tasks</em>, and each edge represents a dependency between two tasks at the same stages of adjacent nodes. For example, assuming <code>fi(u)</code> represents the <code>i</code><sup>th</sup>-stage task of node <code>u</code>, a dependency from <code>u</code> to <code>v</code> requires <code>fi(u)</code> to run before <code>fi(v)</code>. The following figures shows an example of three stage tasks in a DAG of three nodes (<code>A</code>, <code>B</code>, and <code>C</code>) and two dependencies (<code>A-&gt;B</code> and <code>A-&gt;C</code>):</p><div class="m-graph"><svg style="width: 17.000rem; height: 15.000rem;" viewBox="0.00 0.00 169.88 150.00">
<g transform="scale(1 1) rotate(0) translate(4 146)">
<title>L</title>
<g class="m-node m-flat">
<title>a</title>
<polygon points="116.5,-142 45,-142 45,-89 116.5,-89 116.5,-142"/>
<text text-anchor="start" x="53" y="-128.5" font-family="Helvetica,sans-Serif" font-size="10.00">[Node A]</text>
<text text-anchor="start" x="53" y="-117.25" font-family="Helvetica,sans-Serif" font-size="10.00">Step 1: f1(A)</text>
<text text-anchor="start" x="53" y="-106" font-family="Helvetica,sans-Serif" font-size="10.00">Step 2: f2(A)</text>
<text text-anchor="start" x="53" y="-94.75" font-family="Helvetica,sans-Serif" font-size="10.00">Step 3: f3(A)</text>
</g>
<g class="m-node m-flat">
<title>b</title>
<polygon points="71.5,-53 0,-53 0,0 71.5,0 71.5,-53"/>
<text text-anchor="start" x="8" y="-39.5" font-family="Helvetica,sans-Serif" font-size="10.00">[Node B]</text>
<text text-anchor="start" x="8" y="-28.25" font-family="Helvetica,sans-Serif" font-size="10.00">Step 1: f1(B)</text>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">Step 2: f2(B)</text>
<text text-anchor="start" x="8" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">Step 3: f3(B)</text>
</g>
<g class="m-edge">
<title>a&#45;&gt;b</title>
<path d="M67.49,-88.87C63.36,-80.89 58.73,-71.93 54.31,-63.38"/>
<polygon points="57.47,-61.87 49.76,-54.59 51.25,-65.08 57.47,-61.87"/>
</g>
<g class="m-node m-flat">
<title>c</title>
<polygon points="161.88,-53 89.62,-53 89.62,0 161.88,0 161.88,-53"/>
<text text-anchor="start" x="97.62" y="-39.5" font-family="Helvetica,sans-Serif" font-size="10.00">[Node C]</text>
<text text-anchor="start" x="97.62" y="-28.25" font-family="Helvetica,sans-Serif" font-size="10.00">Step 1: f1(C)</text>
<text text-anchor="start" x="97.62" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">Step 2: f2(C)</text>
<text text-anchor="start" x="97.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">Step 3: f3(C)</text>
</g>
<g class="m-edge">
<title>a&#45;&gt;c</title>
<path d="M94.01,-88.87C98.14,-80.89 102.77,-71.93 107.19,-63.38"/>
<polygon points="110.25,-65.08 111.74,-54.59 104.03,-61.87 110.25,-65.08"/>
</g>
</g>
</svg>
</div><p>While we can directly create a taskflow for the DAG (i.e., each task in the taskflow runs <code>f1</code>, <code>f2</code>, and <code>f3</code> sequentially), we can describe the parallelism as a three-stage pipeline that propagates a topological order of the DAG through three stage tasks. Consider a valid topological order of this DAG, <code>A, B, C</code>, its pipeline parallelism can be illustrated in the following figure:</p><div class="m-graph"><svg style="width: 20.600rem; height: 33.200rem;" viewBox="0.00 0.00 206.00 332.00">
<g transform="scale(1 1) rotate(0) translate(4 328)">
<title>R</title>
<g class="m-node m-flat">
<title>f1_A</title>
<polygon points="54,-324 0,-324 0,-288 54,-288 54,-324"/>
<text text-anchor="middle" x="27" y="-302.12" font-family="Helvetica,sans-Serif" font-size="10.00">f1(A)</text>
</g>
<g class="m-node m-flat">
<title>f1_B</title>
<polygon points="54,-252 0,-252 0,-216 54,-216 54,-252"/>
<text text-anchor="middle" x="27" y="-230.12" font-family="Helvetica,sans-Serif" font-size="10.00">f1(B)</text>
</g>
<g class="m-edge">
<title>f1_A&#45;&gt;f1_B</title>
<path d="M27,-287.7C27,-280.41 27,-271.73 27,-263.54"/>
<polygon points="30.5,-263.62 27,-253.62 23.5,-263.62 30.5,-263.62"/>
</g>
<g class="m-node m-flat">
<title>f2_A</title>
<polygon points="126,-252 72,-252 72,-216 126,-216 126,-252"/>
<text text-anchor="middle" x="99" y="-230.12" font-family="Helvetica,sans-Serif" font-size="10.00">f2(A)</text>
</g>
<g class="m-node m-flat">
<title>f2_B</title>
<polygon points="126,-180 72,-180 72,-144 126,-144 126,-180"/>
<text text-anchor="middle" x="99" y="-158.12" font-family="Helvetica,sans-Serif" font-size="10.00">f2(B)</text>
</g>
<g class="m-edge">
<title>f2_A&#45;&gt;f2_B</title>
<path d="M99,-215.7C99,-208.41 99,-199.73 99,-191.54"/>
<polygon points="102.5,-191.62 99,-181.62 95.5,-191.62 102.5,-191.62"/>
</g>
<g class="m-node m-flat">
<title>f3_A</title>
<polygon points="198,-180 144,-180 144,-144 198,-144 198,-180"/>
<text text-anchor="middle" x="171" y="-158.12" font-family="Helvetica,sans-Serif" font-size="10.00">f3(A)</text>
</g>
<g class="m-node m-flat">
<title>f3_B</title>
<polygon points="198,-108 144,-108 144,-72 198,-72 198,-108"/>
<text text-anchor="middle" x="171" y="-86.12" font-family="Helvetica,sans-Serif" font-size="10.00">f3(B)</text>
</g>
<g class="m-edge">
<title>f3_A&#45;&gt;f3_B</title>
<path d="M171,-143.7C171,-136.41 171,-127.73 171,-119.54"/>
<polygon points="174.5,-119.62 171,-109.62 167.5,-119.62 174.5,-119.62"/>
</g>
<g class="m-edge">
<title>f1_B&#45;&gt;f2_A</title>
<path d="M54.28,-234C60.1,-234 65.93,-234 71.75,-234"/>
</g>
<g class="m-node m-flat">
<title>f1_C</title>
<polygon points="54,-180 0,-180 0,-144 54,-144 54,-180"/>
<text text-anchor="middle" x="27" y="-158.12" font-family="Helvetica,sans-Serif" font-size="10.00">f1(C)</text>
</g>
<g class="m-edge">
<title>f1_B&#45;&gt;f1_C</title>
<path d="M27,-215.7C27,-208.41 27,-199.73 27,-191.54"/>
<polygon points="30.5,-191.62 27,-181.62 23.5,-191.62 30.5,-191.62"/>
</g>
<g class="m-edge">
<title>f2_B&#45;&gt;f3_A</title>
<path d="M126.28,-162C132.1,-162 137.93,-162 143.75,-162"/>
</g>
<g class="m-node m-flat">
<title>f2_C</title>
<polygon points="126,-108 72,-108 72,-72 126,-72 126,-108"/>
<text text-anchor="middle" x="99" y="-86.12" font-family="Helvetica,sans-Serif" font-size="10.00">f2(C)</text>
</g>
<g class="m-edge">
<title>f2_B&#45;&gt;f2_C</title>
<path d="M99,-143.7C99,-136.41 99,-127.73 99,-119.54"/>
<polygon points="102.5,-119.62 99,-109.62 95.5,-119.62 102.5,-119.62"/>
</g>
<g class="m-node m-flat">
<title>f3_C</title>
<polygon points="198,-36 144,-36 144,0 198,0 198,-36"/>
<text text-anchor="middle" x="171" y="-14.12" font-family="Helvetica,sans-Serif" font-size="10.00">f3(C)</text>
</g>
<g class="m-edge">
<title>f3_B&#45;&gt;f3_C</title>
<path d="M171,-71.7C171,-64.41 171,-55.73 171,-47.54"/>
<polygon points="174.5,-47.62 171,-37.62 167.5,-47.62 174.5,-47.62"/>
</g>
<g class="m-edge">
<title>f1_C&#45;&gt;f2_B</title>
<path d="M54.28,-162C60.1,-162 65.93,-162 71.75,-162"/>
</g>
<g class="m-edge">
<title>f2_C&#45;&gt;f3_B</title>
<path d="M126.28,-90C132.1,-90 137.93,-90 143.75,-90"/>
</g>
</g>
</svg>
</div><p>At the beginning, <code>f1(A)</code> runs first. When <code>f1(A)</code> completes, it moves on to <code>f2(A)</code> and, meanwhile, <code>f1(B)</code> can start to run together with <code>f2(A)</code>, and so on so forth. The straight line represents two parallel tasks that can overlap in time in the pipeline. For example, <code>f3(A)</code>, <code>f2(B)</code>, and <code>f1(C)</code> can run simultaneously. The following figures shows the task dependency graph of this pipeline workload:</p><div class="m-graph"><svg style="width: 20.600rem; height: 18.800rem;" viewBox="0.00 0.00 206.00 188.00">
<g transform="scale(1 1) rotate(0) translate(4 184)">
<title>R</title>
<g class="m-node m-flat">
<title>f1_A</title>
<polygon points="54,-180 0,-180 0,-144 54,-144 54,-180"/>
<text text-anchor="middle" x="27" y="-158.12" font-family="Helvetica,sans-Serif" font-size="10.00">f1(A)</text>
</g>
<g class="m-node m-flat">
<title>f1_B</title>
<polygon points="126,-180 72,-180 72,-144 126,-144 126,-180"/>
<text text-anchor="middle" x="99" y="-158.12" font-family="Helvetica,sans-Serif" font-size="10.00">f1(B)</text>
</g>
<g class="m-edge">
<title>f1_A&#45;&gt;f1_B</title>
<path d="M54.28,-162C56.28,-162 58.28,-162 60.29,-162"/>
<polygon points="60.24,-165.5 70.24,-162 60.24,-158.5 60.24,-165.5"/>
</g>
<g class="m-node m-flat">
<title>f2_A</title>
<polygon points="54,-108 0,-108 0,-72 54,-72 54,-108"/>
<text text-anchor="middle" x="27" y="-86.12" font-family="Helvetica,sans-Serif" font-size="10.00">f2(A)</text>
</g>
<g class="m-edge">
<title>f1_A&#45;&gt;f2_A</title>
<path d="M27,-143.7C27,-136.41 27,-127.73 27,-119.54"/>
<polygon points="30.5,-119.62 27,-109.62 23.5,-119.62 30.5,-119.62"/>
</g>
<g class="m-node m-flat">
<title>f1_C</title>
<polygon points="198,-180 144,-180 144,-144 198,-144 198,-180"/>
<text text-anchor="middle" x="171" y="-158.12" font-family="Helvetica,sans-Serif" font-size="10.00">f1(C)</text>
</g>
<g class="m-edge">
<title>f1_B&#45;&gt;f1_C</title>
<path d="M126.28,-162C128.28,-162 130.28,-162 132.29,-162"/>
<polygon points="132.24,-165.5 142.24,-162 132.24,-158.5 132.24,-165.5"/>
</g>
<g class="m-node m-flat">
<title>f2_B</title>
<polygon points="126,-108 72,-108 72,-72 126,-72 126,-108"/>
<text text-anchor="middle" x="99" y="-86.12" font-family="Helvetica,sans-Serif" font-size="10.00">f2(B)</text>
</g>
<g class="m-edge">
<title>f1_B&#45;&gt;f2_B</title>
<path d="M99,-143.7C99,-136.41 99,-127.73 99,-119.54"/>
<polygon points="102.5,-119.62 99,-109.62 95.5,-119.62 102.5,-119.62"/>
</g>
<g class="m-node m-flat">
<title>f2_C</title>
<polygon points="198,-108 144,-108 144,-72 198,-72 198,-108"/>
<text text-anchor="middle" x="171" y="-86.12" font-family="Helvetica,sans-Serif" font-size="10.00">f2(C)</text>
</g>
<g class="m-edge">
<title>f1_C&#45;&gt;f2_C</title>
<path d="M171,-143.7C171,-136.41 171,-127.73 171,-119.54"/>
<polygon points="174.5,-119.62 171,-109.62 167.5,-119.62 174.5,-119.62"/>
</g>
<g class="m-edge">
<title>f2_A&#45;&gt;f2_B</title>
<path d="M54.28,-90C56.28,-90 58.28,-90 60.29,-90"/>
<polygon points="60.24,-93.5 70.24,-90 60.24,-86.5 60.24,-93.5"/>
</g>
<g class="m-node m-flat">
<title>f3_A</title>
<polygon points="54,-36 0,-36 0,0 54,0 54,-36"/>
<text text-anchor="middle" x="27" y="-14.12" font-family="Helvetica,sans-Serif" font-size="10.00">f3(A)</text>
</g>
<g class="m-edge">
<title>f2_A&#45;&gt;f3_A</title>
<path d="M27,-71.7C27,-64.41 27,-55.73 27,-47.54"/>
<polygon points="30.5,-47.62 27,-37.62 23.5,-47.62 30.5,-47.62"/>
</g>
<g class="m-edge">
<title>f2_B&#45;&gt;f2_C</title>
<path d="M126.28,-90C128.28,-90 130.28,-90 132.29,-90"/>
<polygon points="132.24,-93.5 142.24,-90 132.24,-86.5 132.24,-93.5"/>
</g>
<g class="m-node m-flat">
<title>f3_B</title>
<polygon points="126,-36 72,-36 72,0 126,0 126,-36"/>
<text text-anchor="middle" x="99" y="-14.12" font-family="Helvetica,sans-Serif" font-size="10.00">f3(B)</text>
</g>
<g class="m-edge">
<title>f2_B&#45;&gt;f3_B</title>
<path d="M99,-71.7C99,-64.41 99,-55.73 99,-47.54"/>
<polygon points="102.5,-47.62 99,-37.62 95.5,-47.62 102.5,-47.62"/>
</g>
<g class="m-node m-flat">
<title>f3_C</title>
<polygon points="198,-36 144,-36 144,0 198,0 198,-36"/>
<text text-anchor="middle" x="171" y="-14.12" font-family="Helvetica,sans-Serif" font-size="10.00">f3(C)</text>
</g>
<g class="m-edge">
<title>f2_C&#45;&gt;f3_C</title>
<path d="M171,-71.7C171,-64.41 171,-55.73 171,-47.54"/>
<polygon points="174.5,-47.62 171,-37.62 167.5,-47.62 174.5,-47.62"/>
</g>
<g class="m-edge">
<title>f3_A&#45;&gt;f3_B</title>
<path d="M54.28,-18C56.28,-18 58.28,-18 60.29,-18"/>
<polygon points="60.24,-21.5 70.24,-18 60.24,-14.5 60.24,-21.5"/>
</g>
<g class="m-edge">
<title>f3_B&#45;&gt;f3_C</title>
<path d="M126.28,-18C128.28,-18 130.28,-18 132.29,-18"/>
<polygon points="132.24,-21.5 142.24,-18 132.24,-14.5 132.24,-21.5"/>
</g>
</g>
</svg>
</div><p>As we can see, tasks in diagonal lines (lower-left to upper-right) can run in parallel. This type of parallelism is also referred to as <em>wavefront</em> parallelism, which sweeps parallel elements in a diagonal direction.</p><aside class="m-note m-info"><h4>Note</h4><p>Depending on the graph size and the number of stage tasks, task graph parallelism and pipeline parallelism can bring very different performance results. For example, a small graph will a long chain of stage tasks may perform better with pipeline parallelism than task graph parallelism, and vice versa.</p></aside></section><section id="CreateAGraphProcessingPipeline"><h2><a href="#CreateAGraphProcessingPipeline">Create a Graph Processing Pipeline</a></h2><p>Using the example from the previous section, we create a three-stage pipeline that encapsulates the three stage tasks (<code>f1, f2, f3</code>) in three pipes. By finding a topological order of the graph, we can transform the node dependency into a sequence of linearly dependent data tokens to feed into the pipeline. The overall implementation is shown below:</p><pre class="m-code"><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;taskflow/taskflow.hpp&gt;</span>
<span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;taskflow/algorithm/pipeline.hpp&gt;</span>

<span class="c1">// 1st-stage function</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">f1</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span><span class="w"> </span><span class="n">node</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;f1(%s)</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">node</span><span class="p">.</span><span class="n">c_str</span><span class="p">());</span>
<span class="p">}</span>

<span class="c1">// 2nd-stage function</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">f2</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span><span class="w"> </span><span class="n">node</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;f2(%s)</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">node</span><span class="p">.</span><span class="n">c_str</span><span class="p">());</span>
<span class="p">}</span>

<span class="c1">// 3rd-stage function</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">f3</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span><span class="w"> </span><span class="n">node</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;f3(%s)</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">node</span><span class="p">.</span><span class="n">c_str</span><span class="p">());</span>
<span class="p">}</span>

<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>

<span class="w">  </span><span class="n">tf</span><span class="o">::</span><span class="n">Taskflow</span><span class="w"> </span><span class="n">taskflow</span><span class="p">(</span><span class="s">&quot;graph processing pipeline&quot;</span><span class="p">);</span>
<span class="w">  </span><span class="n">tf</span><span class="o">::</span><span class="n">Executor</span><span class="w"> </span><span class="n">executor</span><span class="p">;</span>

<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="kt">size_t</span><span class="w"> </span><span class="n">num_lines</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">;</span>
<span class="w">  </span>
<span class="w">  </span><span class="c1">// a topological order of the graph</span>
<span class="w">  </span><span class="c1">//    |-&gt; B</span>
<span class="w">  </span><span class="c1">// A--|</span>
<span class="w">  </span><span class="c1">//    |-&gt; C</span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="w"> </span><span class="n">nodes</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="s">&quot;A&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;B&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;C&quot;</span><span class="p">};</span>

<span class="w">  </span><span class="c1">// the pipeline consists of three serial pipes</span>
<span class="w">  </span><span class="c1">// and up to two concurrent scheduling tokens</span>
<span class="w">  </span><span class="n">tf</span><span class="o">::</span><span class="n">Pipeline</span><span class="w"> </span><span class="n">pl</span><span class="p">(</span><span class="n">num_lines</span><span class="p">,</span>

<span class="w">    </span><span class="c1">// first pipe calls f1</span>
<span class="w">    </span><span class="n">tf</span><span class="o">::</span><span class="n">Pipe</span><span class="p">{</span><span class="n">tf</span><span class="o">::</span><span class="n">PipeType</span><span class="o">::</span><span class="n">SERIAL</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="o">&amp;</span><span class="p">](</span><span class="n">tf</span><span class="o">::</span><span class="n">Pipeflow</span><span class="o">&amp;</span><span class="w"> </span><span class="n">pf</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">      </span><span class="k">if</span><span class="p">(</span><span class="n">pf</span><span class="p">.</span><span class="n">token</span><span class="p">()</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">nodes</span><span class="p">.</span><span class="n">size</span><span class="p">())</span><span class="w"> </span><span class="p">{</span>
<span class="w">        </span><span class="n">pf</span><span class="p">.</span><span class="n">stop</span><span class="p">();</span>
<span class="w">      </span><span class="p">}</span>
<span class="w">      </span><span class="k">else</span><span class="w"> </span><span class="p">{</span>
<span class="w">        </span><span class="n">f1</span><span class="p">(</span><span class="n">nodes</span><span class="p">[</span><span class="n">pf</span><span class="p">.</span><span class="n">token</span><span class="p">()]);</span>
<span class="w">      </span><span class="p">}</span>
<span class="w">    </span><span class="p">}},</span>
<span class="w">    </span>
<span class="w">    </span><span class="c1">// second pipe calls f2</span>
<span class="w">    </span><span class="n">tf</span><span class="o">::</span><span class="n">Pipe</span><span class="p">{</span><span class="n">tf</span><span class="o">::</span><span class="n">PipeType</span><span class="o">::</span><span class="n">SERIAL</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="o">&amp;</span><span class="p">](</span><span class="n">tf</span><span class="o">::</span><span class="n">Pipeflow</span><span class="o">&amp;</span><span class="w"> </span><span class="n">pf</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">      </span><span class="n">f2</span><span class="p">(</span><span class="n">nodes</span><span class="p">[</span><span class="n">pf</span><span class="p">.</span><span class="n">token</span><span class="p">()]);</span>
<span class="w">    </span><span class="p">}},</span>

<span class="w">    </span><span class="c1">// third pipe calls f3</span>
<span class="w">    </span><span class="n">tf</span><span class="o">::</span><span class="n">Pipe</span><span class="p">{</span><span class="n">tf</span><span class="o">::</span><span class="n">PipeType</span><span class="o">::</span><span class="n">SERIAL</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="o">&amp;</span><span class="p">](</span><span class="n">tf</span><span class="o">::</span><span class="n">Pipeflow</span><span class="o">&amp;</span><span class="w"> </span><span class="n">pf</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">      </span><span class="n">f3</span><span class="p">(</span><span class="n">nodes</span><span class="p">[</span><span class="n">pf</span><span class="p">.</span><span class="n">token</span><span class="p">()]);</span>
<span class="w">    </span><span class="p">}}</span>
<span class="w">  </span><span class="p">);</span>

<span class="w">  </span><span class="c1">// build the pipeline graph using composition</span>
<span class="w">  </span><span class="n">tf</span><span class="o">::</span><span class="n">Task</span><span class="w"> </span><span class="n">init</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">taskflow</span><span class="p">.</span><span class="n">emplace</span><span class="p">([](){</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">&quot;ready</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span><span class="w"> </span><span class="p">})</span>
<span class="w">                          </span><span class="p">.</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;starting pipeline&quot;</span><span class="p">);</span>
<span class="w">  </span><span class="n">tf</span><span class="o">::</span><span class="n">Task</span><span class="w"> </span><span class="n">task</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">taskflow</span><span class="p">.</span><span class="n">composed_of</span><span class="p">(</span><span class="n">pl</span><span class="p">)</span>
<span class="w">                          </span><span class="p">.</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;pipeline&quot;</span><span class="p">);</span>
<span class="w">  </span><span class="n">tf</span><span class="o">::</span><span class="n">Task</span><span class="w"> </span><span class="n">stop</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">taskflow</span><span class="p">.</span><span class="n">emplace</span><span class="p">([](){</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">&quot;stopped</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span><span class="w"> </span><span class="p">})</span>
<span class="w">                          </span><span class="p">.</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;pipeline stopped&quot;</span><span class="p">);</span>

<span class="w">  </span><span class="c1">// create task dependency</span>
<span class="w">  </span><span class="n">init</span><span class="p">.</span><span class="n">precede</span><span class="p">(</span><span class="n">task</span><span class="p">);</span>
<span class="w">  </span><span class="n">task</span><span class="p">.</span><span class="n">precede</span><span class="p">(</span><span class="n">stop</span><span class="p">);</span>

<span class="w">  </span><span class="c1">// dump the pipeline graph structure (with composition)</span>
<span class="w">  </span><span class="n">taskflow</span><span class="p">.</span><span class="n">dump</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="p">);</span>

<span class="w">  </span><span class="c1">// run the pipeline</span>
<span class="w">  </span><span class="n">executor</span><span class="p">.</span><span class="n">run</span><span class="p">(</span><span class="n">taskflow</span><span class="p">).</span><span class="n">wait</span><span class="p">();</span>

<span class="w">  </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
<span class="p">}</span></pre><section id="GraphPipelineFindATopologicalOrderOfTheGraph"><h3><a href="#GraphPipelineFindATopologicalOrderOfTheGraph">Find a Topological Order of the Graph</a></h3><p>The first step is to find a valid topological order of the graph, such that we can transform the graph dependency into a linear sequence. In this example, we simply hard-code it:</p><pre class="m-code"><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="w"> </span><span class="n">nodes</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="s">&quot;A&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;B&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;C&quot;</span><span class="p">};</span></pre></section><section id="GraphPipelineDefineTheStageFunction"><h3><a href="#GraphPipelineDefineTheStageFunction">Define the Stage Function</a></h3><p>This particular workload does not propagate data directly through the pipeline. In most situations, data is directly stored in a custom graph data structure, and the stage function will just need to know which node to process. For demo&#x27;s sake, we simply output a message to show which stage function is processing which node:</p><pre class="m-code"><span class="c1">// 1st-stage function</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">f1</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span><span class="w"> </span><span class="n">node</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;f1(%s)</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">node</span><span class="p">.</span><span class="n">c_str</span><span class="p">());</span>
<span class="p">}</span>

<span class="c1">// 2nd-stage function</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">f2</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span><span class="w"> </span><span class="n">node</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;f2(%s)</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">node</span><span class="p">.</span><span class="n">c_str</span><span class="p">());</span>
<span class="p">}</span>

<span class="c1">// 3rd-stage function</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">f3</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span><span class="w"> </span><span class="n">node</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;f3(%s)</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">node</span><span class="p">.</span><span class="n">c_str</span><span class="p">());</span>
<span class="p">}</span></pre><aside class="m-note m-info"><h4>Note</h4><p>A key advantage of Taskflow&#x27;s pipeline programming model is that we do not provide any data abstraction but give users full control over data management, which is typically application-dependent. In an application like this graph processing pipeline, data is managed in a global custom graph data structure, and any data abstraction provided by the library can become a unnecessary overhead.</p></aside></section><section id="GraphPipelineDefineThePipes"><h3><a href="#GraphPipelineDefineThePipes">Define the Pipes</a></h3><p>The pipe structure is straightforward. Each pipe encapsulates the corresponding stage function and passes the node into the function argument. The first pipe will cease the pipeline scheduling when it has processed all nodes. To identify which node is being processed at a running pipe, we use <a href="classtf_1_1Pipeflow.html#a295e5d884665c076f4ef5d78139f7c51" class="m-doc">tf::<wbr />Pipeflow::<wbr />token</a> to find the index:</p><pre class="m-code"><span class="c1">// first pipe calls f1</span>
<span class="n">tf</span><span class="o">::</span><span class="n">Pipe</span><span class="p">{</span><span class="n">tf</span><span class="o">::</span><span class="n">PipeType</span><span class="o">::</span><span class="n">SERIAL</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="o">&amp;</span><span class="p">](</span><span class="n">tf</span><span class="o">::</span><span class="n">Pipeflow</span><span class="o">&amp;</span><span class="w"> </span><span class="n">pf</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="k">if</span><span class="p">(</span><span class="n">pf</span><span class="p">.</span><span class="n">token</span><span class="p">()</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">nodes</span><span class="p">.</span><span class="n">size</span><span class="p">())</span><span class="w"> </span><span class="p">{</span>
<span class="w">    </span><span class="n">pf</span><span class="p">.</span><span class="n">stop</span><span class="p">();</span>
<span class="w">  </span><span class="p">}</span>
<span class="w">  </span><span class="k">else</span><span class="w"> </span><span class="p">{</span>
<span class="w">    </span><span class="n">f1</span><span class="p">(</span><span class="n">nodes</span><span class="p">[</span><span class="n">pf</span><span class="p">.</span><span class="n">token</span><span class="p">()]);</span>
<span class="w">  </span><span class="p">}</span>
<span class="p">}},</span>

<span class="c1">// second pipe calls f2</span>
<span class="n">tf</span><span class="o">::</span><span class="n">Pipe</span><span class="p">{</span><span class="n">tf</span><span class="o">::</span><span class="n">PipeType</span><span class="o">::</span><span class="n">SERIAL</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="o">&amp;</span><span class="p">](</span><span class="n">tf</span><span class="o">::</span><span class="n">Pipeflow</span><span class="o">&amp;</span><span class="w"> </span><span class="n">pf</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="n">f2</span><span class="p">(</span><span class="n">nodes</span><span class="p">[</span><span class="n">pf</span><span class="p">.</span><span class="n">token</span><span class="p">()]);</span>
<span class="p">}},</span>

<span class="c1">// third pipe calls f3</span>
<span class="n">tf</span><span class="o">::</span><span class="n">Pipe</span><span class="p">{</span><span class="n">tf</span><span class="o">::</span><span class="n">PipeType</span><span class="o">::</span><span class="n">SERIAL</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="o">&amp;</span><span class="p">](</span><span class="n">tf</span><span class="o">::</span><span class="n">Pipeflow</span><span class="o">&amp;</span><span class="w"> </span><span class="n">pf</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">  </span><span class="n">f3</span><span class="p">(</span><span class="n">nodes</span><span class="p">[</span><span class="n">pf</span><span class="p">.</span><span class="n">token</span><span class="p">()]);</span>
<span class="p">}}</span></pre></section><section id="GraphPipelineDefineTheTaskGraph"><h3><a href="#GraphPipelineDefineTheTaskGraph">Define the Task Graph</a></h3><p>To build up the taskflow for the pipeline, we create a module task with the defined pipeline structure and connect it with two tasks that output helper messages before and after the pipeline:</p><pre class="m-code"><span class="n">tf</span><span class="o">::</span><span class="n">Task</span><span class="w"> </span><span class="n">init</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">taskflow</span><span class="p">.</span><span class="n">emplace</span><span class="p">([](){</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">&quot;ready</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span><span class="w"> </span><span class="p">})</span>
<span class="w">                        </span><span class="p">.</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;starting pipeline&quot;</span><span class="p">);</span>
<span class="n">tf</span><span class="o">::</span><span class="n">Task</span><span class="w"> </span><span class="n">task</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">taskflow</span><span class="p">.</span><span class="n">composed_of</span><span class="p">(</span><span class="n">pl</span><span class="p">)</span>
<span class="w">                        </span><span class="p">.</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;pipeline&quot;</span><span class="p">);</span>
<span class="n">tf</span><span class="o">::</span><span class="n">Task</span><span class="w"> </span><span class="n">stop</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">taskflow</span><span class="p">.</span><span class="n">emplace</span><span class="p">([](){</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">&quot;stopped</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span><span class="w"> </span><span class="p">})</span>
<span class="w">                        </span><span class="p">.</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;pipeline stopped&quot;</span><span class="p">);</span>
<span class="n">init</span><span class="p">.</span><span class="n">precede</span><span class="p">(</span><span class="n">task</span><span class="p">);</span>
<span class="n">task</span><span class="p">.</span><span class="n">precede</span><span class="p">(</span><span class="n">stop</span><span class="p">);</span></pre><div class="m-graph"><svg style="width: 30.500rem; height: 25.200rem;" viewBox="0.00 0.00 305.00 251.50">
<g transform="scale(1 1) rotate(0) translate(4 247.5)">
<title>Taskflow</title>
<g class="m-cluster">
<title>cluster_p0x7ffd7418c200</title>
<polygon points="8,-8 8,-235.5 139,-235.5 139,-8 8,-8"/>
<text text-anchor="middle" x="73.5" y="-222" font-family="Helvetica,sans-Serif" font-size="10.00">Graph Processing Pipeline</text>
</g>
<g class="m-cluster">
<title>cluster_p0x7ffd7418c110</title>
<polygon points="147,-81 147,-235.5 289,-235.5 289,-81 147,-81"/>
<text text-anchor="middle" x="218" y="-222" font-family="Helvetica,sans-Serif" font-size="10.00">m1</text>
</g>
<g class="m-node m-flat">
<title>p0x7bc4000142e8</title>
<ellipse cx="73" cy="-190.25" rx="49.85" ry="18"/>
<text text-anchor="middle" x="73" y="-186.38" font-family="Helvetica,sans-Serif" font-size="10.00">starting pipeline</text>
</g>
<g class="m-node m-flat">
<title>p0x7bc4000143d0</title>
<polygon points="108.75,-125 41.25,-125 37.25,-121 37.25,-89 104.75,-89 108.75,-93 108.75,-125"/>
<polyline points="104.75,-121 37.25,-121"/>
<polyline points="104.75,-121 104.75,-89"/>
<polyline points="104.75,-121 108.75,-125"/>
<text text-anchor="middle" x="73" y="-103.12" font-family="Helvetica,sans-Serif" font-size="10.00">pipeline [m1]</text>
</g>
<g class="m-edge">
<title>p0x7bc4000142e8&#45;&gt;p0x7bc4000143d0</title>
<path d="M73,-172.02C73,-161.75 73,-148.45 73,-136.64"/>
<polygon points="76.5,-137 73,-127 69.5,-137 76.5,-137"/>
</g>
<g class="m-node m-flat">
<title>p0x7bc4000144b8</title>
<ellipse cx="73" cy="-34" rx="51.18" ry="18"/>
<text text-anchor="middle" x="73" y="-30.12" font-family="Helvetica,sans-Serif" font-size="10.00">pipeline stopped</text>
</g>
<g class="m-edge">
<title>p0x7bc4000143d0&#45;&gt;p0x7bc4000144b8</title>
<path d="M73,-88.81C73,-81.23 73,-72.1 73,-63.54"/>
<polygon points="76.5,-63.54 73,-53.54 69.5,-63.54 76.5,-63.54"/>
</g>
<g class="m-node">
<title>p0x7bc400014030</title>
<polygon points="198,-208.25 167.04,-190.25 198,-172.25 228.96,-190.25 198,-208.25"/>
<text text-anchor="middle" x="198" y="-186.38" font-family="Helvetica,sans-Serif" font-size="10.00">cond</text>
</g>
<g class="m-node m-flat">
<title>p0x7bc400014118</title>
<polygon points="209,-125 155,-125 155,-121 151,-121 151,-117 155,-117 155,-97 151,-97 151,-93 155,-93 155,-89 209,-89 209,-125"/>
<polyline points="155,-121 159,-121 159,-117 155,-117"/>
<polyline points="155,-97 159,-97 159,-93 155,-93"/>
<text text-anchor="middle" x="182" y="-103.12" font-family="Helvetica,sans-Serif" font-size="10.00">rt&#45;0</text>
</g>
<g class="m-edge">
<title>p0x7bc400014030&#45;&gt;p0x7bc400014118</title>
<path stroke-dasharray="5,2" d="M194.92,-173.58C192.85,-163.1 190.07,-149 187.62,-136.55"/>
<polygon points="191.07,-135.93 185.7,-126.79 184.2,-137.28 191.07,-135.93"/>
<text text-anchor="middle" x="192.62" y="-144.75" font-family="Helvetica,sans-Serif" font-size="10.00">0</text>
</g>
<g class="m-node m-flat">
<title>p0x7bc400014200</title>
<polygon points="281,-125 227,-125 227,-121 223,-121 223,-117 227,-117 227,-97 223,-97 223,-93 227,-93 227,-89 281,-89 281,-125"/>
<polyline points="227,-121 231,-121 231,-117 227,-117"/>
<polyline points="227,-97 231,-97 231,-93 227,-93"/>
<text text-anchor="middle" x="254" y="-103.12" font-family="Helvetica,sans-Serif" font-size="10.00">rt&#45;1</text>
</g>
<g class="m-edge">
<title>p0x7bc400014030&#45;&gt;p0x7bc400014200</title>
<path stroke-dasharray="5,2" d="M206.51,-176.91C214.21,-165.73 225.83,-148.87 235.65,-134.63"/>
<polygon points="238.43,-136.75 241.23,-126.53 232.67,-132.78 238.43,-136.75"/>
<text text-anchor="middle" x="231.62" y="-144.75" font-family="Helvetica,sans-Serif" font-size="10.00">1</text>
</g>
</g>
</svg>
</div></section><section id="GraphPipelineSubmitTheTaskGraph"><h3><a href="#GraphPipelineSubmitTheTaskGraph">Submit the Task Graph</a></h3><p>Finally, we submit the taskflow to the execution and run it once:</p><pre class="m-code"><span class="n">executor</span><span class="p">.</span><span class="n">run</span><span class="p">(</span><span class="n">taskflow</span><span class="p">).</span><span class="n">wait</span><span class="p">();</span></pre><p>Three possible outputs are shown below:</p><pre class="m-console"><span class="gp"># </span>possible<span class="w"> </span>output<span class="w"> </span><span class="m">1</span>
<span class="go">ready</span>
<span class="go">f1(A)</span>
<span class="go">f2(A)</span>
<span class="go">f1(B)</span>
<span class="go">f2(B)</span>
<span class="go">f3(A)</span>
<span class="go">f1(C)</span>
<span class="go">f2(C)</span>
<span class="go">f3(B)</span>
<span class="go">f3(C)</span>
<span class="go">stopped</span>

<span class="gp"># </span>possible<span class="w"> </span>output<span class="w"> </span><span class="m">2</span>
<span class="go">f1(A)</span>
<span class="go">f2(A)</span>
<span class="go">f3(A)</span>
<span class="go">f1(B)</span>
<span class="go">f2(B)</span>
<span class="go">f3(B)</span>
<span class="go">f1(C)</span>
<span class="go">f2(C)</span>
<span class="go">f3(C)</span>
<span class="go">stopped</span>

<span class="gp"># </span>possible<span class="w"> </span>output<span class="w"> </span><span class="m">3</span>
<span class="go">ready</span>
<span class="go">f1(A)</span>
<span class="go">f2(A)</span>
<span class="go">f3(A)</span>
<span class="go">f1(B)</span>
<span class="go">f2(B)</span>
<span class="go">f1(C)</span>
<span class="go">f2(C)</span>
<span class="go">f3(B)</span>
<span class="go">f3(C)</span>
<span class="go">stopped</span></pre></section></section><section id="GraphPipelineReference"><h2><a href="#GraphPipelineReference">Reference</a></h2><p>We have applied the graph processing pipeline technique to speed up a circuit analysis problem. Details can be referred to our publication below:</p><ul><li>Cheng-Hsiang Chiu and Tsung-Wei Huang, &quot;<a href="https://tsung-wei-huang.github.io/papers/dac2022.pdf">Efficient Timing Propagation with Simultaneous Structural and Pipeline Parallelisms</a>,&quot; <em>ACM/IEEE Design Automation Conference (DAC)</em>, San Francisco, CA, 2022</li></ul></section>
      </div>
    </div>
  </div>
</article></main>
<div class="m-doc-search" id="search">
  <a href="#!" onclick="return hideSearch()"></a>
  <div class="m-container">
    <div class="m-row">
      <div class="m-col-m-8 m-push-m-2">
        <div class="m-doc-search-header m-text m-small">
          <div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
          <div id="search-symbolcount">&hellip;</div>
        </div>
        <div class="m-doc-search-content">
          <form>
            <input type="search" name="q" id="search-input" placeholder="Loading &hellip;" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
          </form>
          <noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
          <div id="search-help" class="m-text m-dim m-text-center">
            <p class="m-noindent">Search for symbols, directories, files, pages or
            modules. You can omit any prefix from the symbol or file path; adding a
            <code>:</code> or <code>/</code> suffix lists all members of given symbol or
            directory.</p>
            <p class="m-noindent">Use <span class="m-label m-dim">&darr;</span>
            / <span class="m-label m-dim">&uarr;</span> to navigate through the list,
            <span class="m-label m-dim">Enter</span> to go.
            <span class="m-label m-dim">Tab</span> autocompletes common prefix, you can
            copy a link to the result using <span class="m-label m-dim">⌘</span>
            <span class="m-label m-dim">L</span> while <span class="m-label m-dim">⌘</span>
            <span class="m-label m-dim">M</span> produces a Markdown link.</p>
          </div>
          <div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.</div>
          <ul id="search-results"></ul>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="search-v2.js"></script>
<script src="searchdata-v2.js" async="async"></script>
<footer><nav>
  <div class="m-container">
    <div class="m-row">
      <div class="m-col-l-10 m-push-l-1">
        <p>Taskflow handbook is part of the <a href="https://taskflow.github.io">Taskflow project</a>, copyright © <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>, 2018&ndash;2024.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.9.6 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
      </div>
    </div>
  </div>
</nav></footer>
</body>
</html>
